﻿@model ResetPasswordEditModel
@{
    ViewData["Title"] = new string[] { "忘记密码" };
    var errorMessage = TempData.Get<string>("errorMessage", string.Empty);
    var placeholder = string.Empty;
    var registerType = ViewData.Get<RegisterType>("RegisterType", RegisterType.MobileOrEmail);
    switch (registerType)
    {
        case RegisterType.Mobile:
            placeholder = "手机号码/昵称";
            break;
        case RegisterType.Email:
            placeholder = "邮箱/昵称";
            break;
        case RegisterType.MobileOrEmail:
            placeholder = "手机号码/邮箱/昵称";
            break;
        case RegisterType.EmailOrMobile:
            placeholder = "邮箱/手机号码/昵称";
            break;

    }
}
<div class="jh-login-home">
    <h1 class="tn-mb-30 tn-space-xlg-hor">找回帐号密码</h1>
    @using (Html.BeginForm("ResetPassword", "Account", FormMethod.Post, new { @id = "ResetPasswordForm", @class = "tn-space-xlg-hor form-horizontal tn-form-validation " }))
    {
        <div class="form-group">
            @Html.LabelFor(n => n.UserName)
            @Html.TextBoxFor(n => n.UserName, new { @class = "form-control", @placeholder = @placeholder })
            @Html.ValidationMessageFor(n => n.UserName)
            <span id="errorMsg" style="color:red;display:none">@errorMessage</span>
        </div>
        //验证码
        var mathBuildInfoModel = new ViewDataDictionary();
        mathBuildInfoModel.Add("InputText", "换一换");
        mathBuildInfoModel.Add("ErrorMessage", errorMessage);
        mathBuildInfoModel.Add("RequiredMessage", "请输入正确验证码");
        mathBuildInfoModel.Add("IsRequired", true);
        mathBuildInfoModel.Add("Title", "验证码");
        @Html.Captcha(4, "_DefaultCaptchaView", mathBuildInfoModel).AsIntelligent()

        <div class="form-group">
            <button type="submit" class="btn btn-primary tn-btn-wm">确定</button>
        </div>
    }
</div>
<script>
    require(['jquery'],function(){
        //其他错误提示
        $(function() {
            var type = typeof ($("#CaptchaDeTextmp").attr("type"));
            if (type == "string") {
                $("#errorMsg").show();
            }
        });
    })
</script>